import { onUnmounted } from "vue";

export function useIntersection(cb, options) {
  let observer = new IntersectionObserver(cb, options);

  onUnmounted(() => {
    observer.disconnect();
    observer = null;
  });

  return observer;
}
